package com.example.myapplication

 class Student {

     val age:Int = 1
         get() = field*2

    val name by lazy(LazyThreadSafetyMode.NONE) { 2 }

    lateinit var func: (String) -> Unit?

    inline fun change(name: String,  func: (String) -> Unit) {
         // 当作引用使用，需要noinline
         //this.func = func
         // 传递给另外一个函数，需要noinline
         //add(func)
    }

    fun add(func: (String) -> Unit) {

    }


    fun executeCapturing() {
        val i = 2
        change("捕获式Lambda") {
            return
        }
    }


    fun executeNoCapturing() {
        return
        change("非捕获式Lambda") {
            if (it.length == 0) {
                return
            }
        }
    }
}

fun main() {

}